package auth.mapper;

import common.model.user.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Select("select * from user where telephone = #{phone}")
    User findUserByPhone(String phone);
    
    @Insert("insert into user(telephone, username, password, nick_name, icon, create_time, update_time) " +
           "values (#{telephone}, #{telephone}, '123456', #{nickName}, #{icon}, #{createTime}, #{updateTime})")
    void insertUser(User user);

    //更新密码
    @Update("update user set password = #{password} where telephone = #{phone}")
    void updatePassword(String password, String phone);
}
